﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Configuration;
using System.Xml;
using System.Xml.Linq;

namespace GONES.Tools.Common
{
    /// <summary>
    /// 系统名词定义类
    /// </summary>
    public class SmsMessage
    {
        private static SmsMessage _smsMessage;

        private string _getloginname = "";
        private string _getpassword = "";
        private string _bill5 = "";
        private string _bill6 = "";
        private string _bill7 = "";
        private string _msg = "";
        private string _backmsg = "";
        private string _customer = "";

        /// <summary>
        /// 找回登录名短信内容
        /// </summary>
        public string GetloginnameMsg
        {
            get { return _getloginname; }
        }

        /// <summary>
        /// 找回登录密码短信内容
        /// </summary>
        public string GetpasswordMsg
        {
            get { return _getpassword; }
        }
        /// <summary>
        /// 接收客户订单短信提醒内容
        /// </summary>
        public string Bill5
        {
            get { return _bill5; }
        }
        /// <summary>
        /// 接收客户退货单短信提醒内容
        /// </summary>
        public string Bill6
        { get { return _bill6; } }
        /// <summary>
        /// 接收收货单短信提醒内容
        /// </summary>
        public string Bill7
        { get { return _bill7; } }
        /// <summary>
        /// 站内信短信提醒内容
        /// </summary>
        public string Msg
        { get { return _msg; } }
        /// <summary>
        /// 检验不合格短信提醒内容
        /// </summary>
        public string BackMsg
        { get { return _backmsg; } }
        /// <summary>
        /// 客户关系删除短信提醒内容
        /// </summary>
        public string Customer
        { get { return _customer; } }
        private SmsMessage()
        {
            XDocument xml = XDocument.Load(HttpContext.Current.Server.MapPath("~/Configs/SmSMessage.xml"));
            _getloginname =
                xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_getloginname").First().Attribute(
                    "value").Value;
            _getpassword =
                xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_getpassword").First().Attribute(
                    "value").Value;
            _bill5 =
                xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_bill5").First().Attribute(
                    "value").Value;
            _bill6 =
                xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_bill6").First().Attribute(
                    "value").Value;
            _bill7 =
                xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_bill7").First().Attribute(
                    "value").Value;
            _msg = xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_msg").First().Attribute(
                    "value").Value;
            _backmsg = xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_backmsg").First().Attribute(
                    "value").Value;
            _customer = xml.Root.Elements("node").Where(n => n.Attribute("name").Value == "_customer").First().Attribute(
                    "value").Value;
        }


        public static SmsMessage MessageStr
        {
            get { return _smsMessage ?? (_smsMessage = new SmsMessage()); }
        }
    }
}